package com.neu.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neu.mapper.RoomdueMapper;
import com.neu.mapper.RoominfoMapper;
import com.neu.po.Roomdue;

import com.neu.po.Roominfo;

@Service
public class RoominfoServiceImpl implements RoominfoService {
	
	@Autowired
	private RoominfoMapper roominfoMapper;
	
	@Autowired
	private RoomdueMapper roomdueMapper;
	//多条件查询
	
	@Override
	public PageInfo<Roominfo> getRoomInfo(int pageNum ,int pageSize,String roomid,String loucengu,Date dates) {
		PageHelper.startPage(pageNum,pageSize);
		
		 List<Roominfo> list2 =new ArrayList<>();

		 list2 = roominfoMapper.getloucengroomtype("%"+roomid+"%", "%"+loucengu+"%",dates);
				
		 
		
		PageInfo<Roominfo> pageInfo = new PageInfo<>(list2);
		return pageInfo;
	}
	//插入预定
	@Override
	public int insert(Roomdue type) {
		// TODO Auto-generated method stub
		return roomdueMapper.insert(type);
	}
	//查询条件时间预定
	@Override
	public List<Roomdue> selectTime(String infodate) {
		
		
		return roomdueMapper.selectdate(infodate);
	}
	//修改预定
	@Override
	public int updates(Roomdue type) {
		// TODO Auto-generated method stub
		return roomdueMapper.updateByPrimaryKey(type);
	}
	//删除删除
	@Override
	public int delete(int id) {
		// TODO Auto-generated method stub
		return roomdueMapper.deleteByPrimaryKey(id);
	}
	
	
	
}
